<template>
  <view>
    <cu-custom bgColor="bg-gradual-green" :isBack="true">
      <block slot="backText">返回</block>
      <block slot="content">FMS测试</block>
    </cu-custom>

    <view class="quan">
      <view class="tianj" style="background-image: url(../../static/BasicsBg.png);">
        <view class="jingt">
          添加FMS测试后，可以更好的定制合适您的训练
        </view>
        <view class="pingg" @click="jump" data-src='/pagesA/fms_test/create_fms'>
          + 添加FMS测试
        </view>
      </view>
      <view v-if="datas1.length">
        <view class="u-f-ac relative" style="border-bottom: 1px solid #ddd;padding: 10rpx 0;" v-for="(item, index) in datas1" :key="index"
          @click="jump" :data-src='"/pagesA/fms_test/fms_details?id="+item.id'>
          <view class="zuo">
            FMS测试
          </view>
          <view class="zuo countScores">
            总分:{{item.countScores}}
          </view>
          <view class="you u-f-ajc">
            <view class="shuz" style="border-right: 2upx solid #ddd;">
              {{item.userName}}
            </view>
            <view class="shuz">
              {{item.createTime}}
            </view>
            <view class="cuIcon-right"></view>
          </view>
        </view>
      </view>
      <image v-else class="zanw" src="/static/11.png" mode=""></image>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        id: '',
        user: '',
        datas1: [],
      };
    },
    onLoad: function(e) {
      this.user = uni.getStorageSync("phyUser");
      if (e.id) this.id = e.id;
      else this.id = this.user.userId;
    },
    onShow() {
      this.getData(this.id);
    },
    methods: {
      async getData(memberId) {
        let {
          data: {
            datas
          }
        } = await this.$myRuquest({
          url: "/coach/body/getFMSTestVOList",
          data: {
            memberId,
          }
        })
        this.datas1 = datas;
      },

      jump(e) {
        let url = e.currentTarget.dataset.src;
        uni.navigateTo({
          url
        });
      },
    }
  }
</script>

<style lang="scss">
  .quan {
    background: #ffffff;
  }

  .tianj {
    height: 400upx;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .jingt {
    font-size: 30upx;
    font-weight: 555;
    color: #ffffff;
    padding: 40upx;
  }

  .pingg {
    font: 24upx;
    font-weight: 555;
    background: #128de6;
    border-radius: 40upx;
    padding: 20upx;
    color: #ffffff;
  }

  .zuo {
    font-size: 26upx;
    font-weight: 555;
    padding: 20upx;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .countScores {
    background-color: $uni-color-zhuti;
    color: #FFFFFF;
    padding: 4rpx 20rpx;
    border-radius: 20rpx;
    font-size: 22rpx;
  }

  .you {
    padding: 20upx;
    font-size: 24upx;
    color: #cecece;
    position: absolute;
    right: 0;
  }

  .shuz {
    padding: 10upx;
  }

  .zanw {
    width: 100%;
    height: 800upx;
  }
</style>
